<?php
    class Promotion_m extends Model{
        function Promotion_m(){
            parent::Model();
            $this->load->database();    
        }
        function get_all_promotion($per_page,$offset){
            $this->db->select();
            $this->db->from('promotion');
            $this->db->limit($per_page,$offset);
            $query=$this->db->get();
            return $query->result_array();
        }
         function get_promotion($id){
    $query = $this->db->get_where('promotion', array('id'=>$id)); 
         return $query->row_array();  
      }
       function update_promotion($data,$id) {
         return $this->db->update('promotion',$data,array('id'=>$id));     
       }
      function add_promotion($data){
           $query= $this->db->insert('promotion',$data);
            return $query;
            }
     function delete_promotion($id){
           return $this->db->delete('promotion',array('id'=>$id));   
      }
            
    }
?>
